package dilmaj.client;

import javax.jdo.annotations.*;

import dilmaj.shared.TermVO;
import dilmaj.shared.UserVO;

@PersistenceCapable
public class UserJDO {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;
    
    @Persistent
	private String username="";
    
    @Persistent
	private String password="";
    
    @Persistent
	private String email="";
    
    public UserJDO() {
    
    }
    
    public UserJDO(UserVO userVO) {
    	id=userVO.getId();
    	
    	if (userVO.getUsername()==null)
    		username="";
    	else
    		username=userVO.getUsername();
    	
    	/*if (userVO.getPassword()==null)
    		password="";
    	else
    		password=userVO.getPassword();*/
    	
    	if (userVO.getEmail()==null)
    		email="";
    	else
    		email=userVO.getEmail();
    }
    
    public UserJDO(String username, String password) {
    	this.username=username;
    	this.password=password;
    }
	
	public Long getId() {
		return id;
	}
	
	public String getUsername() {
		return username;
	}
	
	public String getPassword() {
		return password;
	}
	
	public String getEmail() {
		return email;
	}
}
